package com.example.shoppingmall.service;

import com.example.shoppingmall.dao.CouponMapper;
import com.example.shoppingmall.pojo.Conditioned;
import com.example.shoppingmall.pojo.Consequence;
import com.example.shoppingmall.pojo.Coupon;
import com.example.shoppingmall.pojo.Ticket;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CouponService {

    @Resource
    CouponMapper couponMapper;
    //查询秒杀信息
    public List<Coupon> getAll(int ono, String name, int status, String startTime, String endTime, int dang, int size){

        int num=(dang-1)*size;

        return  couponMapper.getAll(ono,name,status,startTime,endTime,num,size);
    }
    //分页总条数
    public int count( int ono,String name,int status,String startTime,String endTime){

        return couponMapper.count(ono,name,status,startTime,endTime);
    }

    public List<Conditioned> getAllConditioned(){

        return couponMapper.getAllConditioned();
    }
    public int add(Coupon coupon){

        return couponMapper.add(coupon);
    }

    public List<Consequence> getAllConsequence(){

        return couponMapper.getAllConsequence();
    }

    public int del(int id){

        return couponMapper.del(id);
    }

    public int update(Coupon coupon){

        return couponMapper.update(coupon);
    }

    public Coupon getById(int id){

        return couponMapper.getById(id);
    }

    public  List<Ticket> getByIdTick(String couponNameT,int employ,String generatedTime,int id,int dang,int size){

        int num=(dang-1)*size;
        return couponMapper.getByIdTick(couponNameT,employ,generatedTime,id,num,size);
    }

    public int countByIdTick(String couponNameT,int employ,String generatedTime,int id){

        return couponMapper.countByIdTick(couponNameT,employ,generatedTime,id);
    }

    public int delTicket(int id){

        return couponMapper.delTicket(id);
    }

    public int delTicketCouponId(int id){

        return couponMapper.delTicketCouponId(id);
    }
}
